/*
* @author : lj
* @creation : 2014-6-10 下午3:20:00
* @description : 
*	我的停车场管理，用户：停车场管理员，可以添加停车场和维护停车场信息
*/

package com.action.park;

import java.util.List;

import com.bean.ParkComment;
import com.bean.ParkManager;
import com.service.parkCommentService;
import com.util.GUtil;

public class MyParkComment extends BaseParkAction {
	ParkComment comment;
	parkCommentService service;
	List<Object> list=null;
	
	/**
	 * <p>Title: handle 默认处理方法</p>
	 * <p>Description:  默认处理方法</p>
	 * @return see com.util.Util#
	 * @throws Exception
	 * @see com.action.park.BaseParkAction#handle()
	 */
	@Override
	public String handle() throws Exception {
		if(id!=null && id>0)
			return this.view();
		return this.query();
	}
	@Override
	public String view() throws Exception {
		if(id==null || id<1)
			return GUtil.ERROR;
	//comment = (	ParkComment) service.get(id.intValue());
		if(comment==null)
			return GUtil.ERROR;
		return GUtil.VIEW;
	}
	@Override
	public String add() throws Exception {
		this.setHeaderTitle("添加");
		
		
		return GUtil.EDIT;
	}

	@Override
	public String update() throws Exception {
		this.setHeaderTitle("修改");
		
			return GUtil.EDIT;
		
	}
	public String lookinfo() throws Exception {
		this.setHeaderTitle("查看留言详情");
		if(id==null){
			return GUtil.ERROR;
		}
		session.put("commen", service.get(Long.valueOf(id)));
		return "lookcomm";
		
	}
	public String backcomm() throws Exception {
		this.setHeaderTitle("回复留言");
		if(id==null){
			return GUtil.ERROR;
		}
		session.put("commen", service.get(Long.valueOf(id)));
		return "back";
	}

	/**
	 * <p>Title: query 查询我的停车场信息</p>
	 * <p>Description: 查询我的停车场信息</p>
	 * @return 我的停车场列表
	 * @throws Exception
	 * @see com.action.park.BaseParkAction#query()
	 */
	@Override
	public String query() throws Exception {
		parkuser = (ParkManager) session.get("parkuser");
		if(parkuser==null)
			return GUtil.LOGIN;
		list = service.findAll(comment, user);
		return GUtil.SUCCESS;
	}

	@Override
	public String delete() throws Exception {
		return this.query() ;//
	}

	public List<Object> getList() {
		return list;
	}
	public void setList(List<Object> list) {
		this.list = list;
	}
	public parkCommentService getService() {
		return service;
	}
	public void setService(parkCommentService service) {
		this.service = service;
	}
	@Override
	public boolean validate(Object obj) throws Exception {
		return false;
	}
}
